Do not set completed if NoSuchVersion in removeObjects#1710
Do not set completed if NoSuchVersion in removeObjects#1710balamurugana wants to merge 1 commit into
Conversation
Previously if batch object removal gets `NoSuchVersion` error only, the iterator stops processing next batches. This is fixed by continue processing next batches for `NoSuchVersion` but stops for other errors. Signed-off-by: Bala.FA <bala@minio.io>
📝 WalkthroughWalkthroughIn ChangesremoveObjects Iterator Completion Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
api/src/main/java/io/minio/MinioAsyncClient.java (1)
1120-1139: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winAvoid recursive
hasNext()now that NoSuchVersion-only batches continue.With
completed = error != null, many consecutive all-NoSuchVersionbatches now flow intoreturn hasNext();(Line 1139), which can recurse per batch and eventually overflow the stack on large inputs. Switch this tail-recursive path to a loop.💡 Proposed fix
`@Override` public boolean hasNext() { - while (error == null && errorIterator == null && !completed) { - populate(); - } - - if (error == null && errorIterator != null) setError(); - if (error != null) return true; - if (completed) return false; - - errorIterator = null; - return hasNext(); + while (true) { + while (error == null && errorIterator == null && !completed) { + populate(); + } + + if (error == null && errorIterator != null) setError(); + if (error != null) return true; + if (completed) return false; + + errorIterator = null; + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@api/src/main/java/io/minio/MinioAsyncClient.java` around lines 1120 - 1139, The hasNext() implementation in MinioAsyncClient now recurses through repeated all-NoSuchVersion batches via the final return hasNext() path, which can grow the call stack on large inputs. Replace that tail-recursive fallback in hasNext() with an explicit loop that keeps advancing until error, completion, or a non-empty errorIterator is found, while preserving the current populate() and setError() behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@api/src/main/java/io/minio/MinioAsyncClient.java`:
- Around line 1120-1139: The hasNext() implementation in MinioAsyncClient now
recurses through repeated all-NoSuchVersion batches via the final return
hasNext() path, which can grow the call stack on large inputs. Replace that
tail-recursive fallback in hasNext() with an explicit loop that keeps advancing
until error, completion, or a non-empty errorIterator is found, while preserving
the current populate() and setError() behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d16160ca-243f-478b-9bde-6b2fa6fa4aa6
📒 Files selected for processing (1)
api/src/main/java/io/minio/MinioAsyncClient.java
Previously if batch object removal gets
NoSuchVersionerror only, the iterator stops processing next batches. This is fixed by continue processing next batches forNoSuchVersionbut stops for other errors.Summary by CodeRabbit